<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $start = input('start');
        $end = input('end');
        $md5 = md5(md5('aibeili'));
        $sign = input('sign');
        if($sign != $md5){
            $this->error('签名错误');
        }
        //e92a6df6d6286838cd32de03c928a5d7
        $limit = input('limit')?(int)input('limit'):20;
        if(!empty($start)){
            $where[] = ['test_date',['>=',$start],['<',$end]];
            $where[] = ['startTime',['>',$start],['<',$end]];
            $data = Db::table('fa_shopro_report')
                ->where($where)
                ->order('id desc')
                ->paginate($limit);
            $this->success('请求成功',$data);
        }else{
            $where = '';
        }

    }
}
